CREATE TABLE [dbo].[ProximityRadius](
	[ProximityRadiusId] [int] IDENTITY(1,1) NOT NULL,
	[FromRadius] [int] NOT NULL,
	[ToRadius] [int] NOT NULL,
	[RatePerPush] [money] NOT NULL,
	[FixedCost] [money] NOT NULL,
 CONSTRAINT [PK_ProximityRadius] PRIMARY KEY CLUSTERED 
(
	[ProximityRadiusId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
ALTER TABLE [dbo].[ProximityRadius] ADD  CONSTRAINT [DF_ProximityRadius_RatePerPush]  DEFAULT ((0)) FOR [RatePerPush]
GO
ALTER TABLE [dbo].[ProximityRadius] ADD  CONSTRAINT [DF_ProximityRadius_FixedCost]  DEFAULT ((0)) FOR [FixedCost]
GO
CREATE PROCEDURE [dbo].[spProximityRadius_GetList]
AS
BEGIN
	SET NOCOUNT ON

	SELECT *
	FROM [ProximityRadius] (NOLOCK)
	ORDER BY FromRadius
END
GO
CREATE PROCEDURE [dbo].[spProximityRadius_Update]
(
	@ProximityRadiusId INT,
	@FromRadius INT,
	@ToRadius INT,
	@RatePerPush MONEY,
	@FixedCost MONEY
)
AS

BEGIN
	SET NOCOUNT ON

	UPDATE ProximityRadius
	SET FromRadius = @FromRadius, ToRadius = @ToRadius, RatePerPush = @RatePerPush, FixedCost = @FixedCost
	WHERE (ProximityRadiusId = @ProximityRadiusId)
END
GO



SET IDENTITY_INSERT [dbo].[ProximityRadius] ON
INSERT [dbo].[ProximityRadius] ([ProximityRadiusId], [FromRadius], [ToRadius], [RatePerPush], [FixedCost]) VALUES (1, 0, 25, 0.0000, 0.0000)
INSERT [dbo].[ProximityRadius] ([ProximityRadiusId], [FromRadius], [ToRadius], [RatePerPush], [FixedCost]) VALUES (2, 0, 10, 0.0000, 0.0000)
INSERT [dbo].[ProximityRadius] ([ProximityRadiusId], [FromRadius], [ToRadius], [RatePerPush], [FixedCost]) VALUES (4, 0, 5, 0.0000, 0.0000)
INSERT [dbo].[ProximityRadius] ([ProximityRadiusId], [FromRadius], [ToRadius], [RatePerPush], [FixedCost]) VALUES (5, 0, 1, 0.0000, 0.0000)
INSERT [dbo].[ProximityRadius] ([ProximityRadiusId], [FromRadius], [ToRadius], [RatePerPush], [FixedCost]) VALUES (6, 26, 200, 0.0000, 0.0000)
SET IDENTITY_INSERT [dbo].[ProximityRadius] OFF
